package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.Bank;
import com.acme.bankapp.domain.bank.Client;
import com.acme.bankapp.exceptions.BankException;
import com.acme.bankapp.exceptions.ClientExistsException;

public class BankService {

	public static void addClient(Bank bank, Client client) throws ClientExistsException {
		bank.addClient(client);
	}
	
	public static void modifyBank(Bank bank, Client client, int amount) throws BankException {
		client.getAccount().withdraw(amount);
	}
	
	public static void printBalance(Bank bank) {
		for (Client client : bank.getClients()) {
			System.out.println( client.getAccount().getBalance() );
		}
	}
	
	public static void printMaximumAmountToWithdraw(Bank bank) {
		for (Client client : bank.getClients()) {
			System.out.println( client.getAccount().maximumAmountToWithdraw() );
		}
	}
}
